<template>
  <div>
    <van-row class="header_row">
      <van-col span="8"><div class="quxiao" @click="quxiao">取消</div></van-col>
      <van-col span="8"></van-col>
      <van-col span="8"
        ><van-button type="primary" class="button_van" @click="fabiao"
          >发表</van-button
        ></van-col
      >
    </van-row>
    <template>
      <van-field
        v-model="value"
        rows="5"
        autosize
        type="textarea"
        placeholder="说点什么..."
        show-word-limit
        @focus="show = true"
        @blur="show = false"
      />
    </template>
    <div class="shangchaung">
      <van-uploader :before-read="beforeRead" capture />
      <van-uploader :before-read="beforeRead" />
      <van-uploader :before-read="beforeRead" />
    </div>
    <van-number-keyboard v-model="value" :show="show" />
  </div>
</template>
<script>
export default {
  data() {
    return {
      show: false,
      value: "",
      
    };
  },
  methods: {
    // 返回布尔值
    beforeRead(file) {
      if (file.type !== "image/jpeg") {
        Toast("请上传 jpg 格式图片");
        return false;
      }
      return true;
    },
    // 返回 Promise
    asyncBeforeRead(file) {
      return new Promise((resolve, reject) => {
        if (file.type !== "image/jpeg") {
          Toast("请上传 jpg 格式图片");
          reject();
        } else {
          let img = new File(["foo"], "bar.jpg", {
            type: "image/jpeg",
          });
          resolve(img);
        }
      });
    },
    // 取消发表
    quxiao() {
       this.$router.push({ path: "/found" }).catch((error) => error);
    },
    // 发表朋友圈
    fabiao() {
       this.$router.push({ path: "/found" }).catch((error) => error);
    },
  },
};
</script>

<style lang="less" scoped>
.header_row {
  height: 49px;
  line-height: 59px;
  margin-left: 20px;
  .quxiao {
    cursor: pointer;
    line-height: 65px;
    font-size: 18px;
  }
  .button_van {
    width: 62px;
    height: 30px;
    margin-left: 20px;
  }
}
.van-field {
  height: 200px;
}
div.van-cell::after {
  content: "";
  border: none;
}
.shangchaung {
  margin: 0 10px;
  .van-uploader {
    margin: 0 5px;
  }
}
</style>